﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using QLChoDiaOc.Process;

namespace QLChoDiaOc.Forms
{
    /// <summary>
    /// Interaction logic for WinLoaiDiaOc.xaml
    /// </summary>
    public partial class WinLoaiDiaOc : Window
    {
        GetID _getID = new GetID();
        InsertInfo _insertInfo = new InsertInfo();

        public WinLoaiDiaOc()
        {
            InitializeComponent();
            maLoaiDicOcWinTextBox.Text = _getID.GenerateMaLoaiDiaOc();
        }

        private void btnThemLoaiDiaOcWin_Click(object sender, RoutedEventArgs e)
        {
            if (tenLoaiDiaOcWinTextBox.Text == "")
                MessageBox.Show("Nhập đầy đủ thông tin", "Thông Báo");
            else
            {
                try
                {
                    _insertInfo.InsertLoaiDiaOc(maLoaiDicOcWinTextBox.Text, tenLoaiDiaOcWinTextBox.Text);
                    btnThemLoaiDiaOcWin.IsEnabled= false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Thông Báo");
                }
            }
        }

        private void btnThoatLoaiDiaOcWin_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
